package com.woniuxy.service.basics.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.woniuxy.dao.BookMapper;
import com.woniuxy.dao.DriverMapper;
import com.woniuxy.pojo.Driver;
import com.woniuxy.service.basics.DriverService;

@Service
public class DriverServiceImpl implements DriverService{

	@Autowired
	private DriverMapper driverMapper;
	@Override
	public PageInfo selectAll(Integer dr_pn,String dr_conditionBy,String dr_condition) {
		// TODO Auto-generated method stub
		PageHelper.startPage(dr_pn, 5);
		List<Driver> list = driverMapper.selectAll(dr_conditionBy,dr_condition);
		PageInfo pageInfo = new PageInfo(list,3);
		return pageInfo;
	}
	@Override
	public void addDriver(Driver driver) {
		driverMapper.insertSelective(driver);
		
	}
	@Override
	public void deleteByDriverId(Integer driverId) {
		driverMapper.deleteByPrimaryKey(driverId);
		
	}
	@Override
	public int batchDelete(Integer[] driverIds) {
		return driverMapper.batchDelete(driverIds);
	}
	@Override
	public Driver selectById(Integer id) {
		return driverMapper.selectByPrimaryKey(id);
	}
	@Override
	public void updateDriver(Driver driver) {
		driverMapper.updateByPrimaryKey(driver);		
	}
	@Override
	public List<String> selectAllDriverName() {
		// TODO Auto-generated method stub
		return driverMapper.selectAllDriverName();
	}
	

}
